home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / nntp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-31  |  6.0 KB  |  222 lines

  1. #ifndef _NNTP_H
  2. #define _NNTP_H
  3.  
  4. #ifndef _GLOBAL_H
  5. #include "global.h"
  6. #endif
  7.  
  8. #ifndef _TIMER_H
  9. #include "timer.h"
  10. #endif
  11.  
  12. #ifndef _SMTP_H
  13. #include "smtp.h"
  14. #endif
  15.  
  16.  
  17. /****************************************************************/
  18. /*                                                              */
  19. /*       Compiler option for nntp restriction (DG1ZX)        */
  20. /*                                                              */
  21. /*  Reject user request when no top level group is selected     */
  22. /*  e.g. * | *.* | *.*.*                                        */
  23. /*                                                              */
  24. /****************************************************************/
  25. #define NNTPRESTRICT
  26.  
  27. /****************************************************************/
  28. /*                                                              */
  29. /*       Compiler option for nntp history lifetime (DG1ZX)    */
  30. /*                                                              */
  31. /*  Reject user request when poll date is older than history    */
  32. /*  lifetime. Analyse incoming articles if lifetime exceeded    */
  33. /*                                                              */
  34. /****************************************************************/
  35. #define NNTPLIFETIME
  36.  
  37. /****************************************************************/
  38. /*                                                              */
  39. /*       Compiler option for POST command (DG1ZX)        */
  40. /*                                                              */
  41. /****************************************************************/
  42. #define POST_ENBL
  43.  
  44. /************************************************************************/
  45. /*                                     */
  46. /*   Compiler option for XHDR command (DG1ZX)                */
  47. /*                                      */
  48. /*   syntax: XHDR header [articlerange]                 */
  49. /*                                      */
  50. /*   header is a case-insensitive header field, minus any colons.     */
  51. /*   articlerange is one of:                         */
  52. /*   - an article number                         */
  53. /*   - an article number followed by a dash to indicate all following     */
  54. /*   - an article number followed by a dash followed by another article */
  55. /*     number                                  */
  56. /*                                      */
  57. /*   e.g.,                                 */
  58. /*                                      */
  59. /*   XHDR subject                 retrieve subject of current article     */
  60. /*   XHDR subject 5589-6325       retrieve subject of arts 5589 to 6325 */
  61. /*   XHDR subject 5589-           retrieve subject of arts 5589 and up     */
  62. /*   XHDR subject 5589            retrieve subject of art 5589 only     */
  63. /*                                      */
  64. /*   This command is an extension and not included in RFC 977.        */
  65. /*                                      */
  66. /************************************************************************/
  67. #define XHEADER
  68.  
  69. #define SECONDS     (1L)
  70. #define MINUTES     (60L * SECONDS)
  71. #define HOURS       (60L * MINUTES)
  72. #define DAYS        (24L * HOURS)
  73.  
  74. #define LineLen 512
  75.  
  76. struct nntpsv {
  77.     int s;
  78.     int ret;
  79.     int debug;
  80.     int slave;
  81.     unsigned  first;
  82.     unsigned  last;
  83.     unsigned  pointer;
  84.     unsigned  hold_i;
  85.  
  86.     char buf[LineLen];
  87.     char *newnews;
  88.     char *path;
  89.     char *id;
  90.  
  91.     int32 dest;
  92.     int32 unixtime;
  93.     long ftime;
  94.     struct date *datest;
  95.     struct time *timest;
  96.  
  97.     struct article *ap;
  98. };
  99. #define NULLNNTPSV (struct nntpsv *)0
  100.  
  101. struct article {
  102.     char *group;
  103.     char *id;
  104.     char *path;
  105.     unsigned number;
  106.     unsigned tmpu;
  107.     struct article *next;
  108. };
  109. #define NULLARTICLE (struct article *)0
  110.  
  111. struct post {
  112.     char *user;
  113.     char *reply;
  114.     char *sig;
  115.     char *organ;
  116.     char *fullname;
  117. };
  118. #define NULLPOST (struct post *)0
  119.  
  120. struct groups {
  121.     struct article *a;
  122.     struct article *next;
  123. };
  124. #define NULLGROUP (struct groups *)0
  125.  
  126. struct head {
  127.     char *from;
  128.     char *reply_to;
  129.     char *subject;
  130.     char *id;
  131. };
  132. #define NULLHEAD (struct head *)0
  133.  
  134. struct g_list {
  135.     char *str;
  136.     struct g_list *next;
  137. };
  138. #define NULLG (struct g_list *)0
  139.  
  140. struct search {
  141.     struct g_list *not;
  142.     struct g_list *all;
  143.     struct g_list *group;
  144. };
  145. #define NULLSEARCH (struct search *)0
  146.  
  147. struct DFREE {
  148.     unsigned char drive;
  149.     unsigned long bytes;
  150.     struct DFREE *next;
  151. };
  152. #define NULLDRV (struct DFREE *)0
  153.  
  154. struct Servers {
  155.     struct timer nntpt;
  156.     char *name;
  157.     int32 dest;
  158.     char *newsgroups;       /* list of newsgroups */
  159.     int lowtime;            /* for connect window */
  160.     int hightime;
  161.     struct Servers *next;
  162. };
  163. #define NULLSERVER (struct Servers *)0
  164.  
  165. extern char NEol[];
  166.  
  167. int nntp1     __ARGS((int argc, char *argv[], void *p));
  168. int nntp0     __ARGS((int argc, char *argv[], void *p));
  169. int donntp     __ARGS((int argc, char *argv[], void *p));
  170. int nnGpost __ARGS((FILE *data,char *from,struct list *le));
  171.  
  172. /* in nntpcli.c */
  173. extern char *Host;
  174. extern char msgid[];
  175. extern char subj[];
  176. extern char ngrps[];
  177. extern char ndate[];
  178. extern char frm[];
  179. extern char reply_to[];
  180. extern char pth[];
  181. extern int LzwActive;
  182. extern int16 Nntpquiet;
  183. extern struct post Post;
  184. extern struct Servers *Nntpserver;
  185. extern int fullauto;
  186. #ifdef POST_ENBL
  187. extern int postingok;
  188. #endif
  189. #ifdef NNTPRESTRICT
  190. extern int restrict;
  191. #endif
  192. #ifdef NNTPLIFETIME
  193. extern int16 lifetime;
  194. #endif
  195.  
  196. /* in nntpserv.c */
  197. extern char fatal[];
  198. /*int doarticle __ARGS((char *buf,struct nntpsv *mp,char flag)); */
  199. int doarticle __ARGS((char *buf,struct nntpsv *mp,char flag, char *hname));
  200.  
  201. /* in nntpsubr.c */
  202. extern int Filecheck;
  203. time_t articletime __ARGS((char *line));
  204. int check_system __ARGS((void));
  205. void rip2 __ARGS((char *s));
  206. int recv_file __ARGS((FILE *fp,int s));
  207. int check_article __ARGS((char *id));
  208. int xfer_article2 __ARGS((FILE *fp,struct nntpsv *mp));
  209. int garbled __ARGS((FILE *fp));
  210. int check_blank __ARGS((char *bp));
  211. int get_path2 __ARGS((struct article *ap));
  212. int32 make_nntime __ARGS((struct date *d,struct time *t,char *str));
  213. #if (defined(NNTPRESTRICT) || defined(NNTPLIFETIME))
  214. int newnews __ARGS((char *string,struct nntpsv *mp,FILE *f,char serv_cli));
  215. #else
  216. int newnews __ARGS((char *string,struct nntpsv *mp,FILE *f));
  217. #endif
  218. int check_ihave __ARGS((FILE *fp, char *id,struct nntpsv *mp, char *hostn));
  219. int make_path __ARGS((char *group,char w));
  220.  
  221. #endif /* _NNTP_H */
  222.